package GUI;


import javax.swing.JPanel;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JLabel;

import client.ClientConsole;

import java.awt.Font;

/**this class is manager main menu*/
public class GUI_ManagerMenu extends JPanel
{
	/**clc instance of ClientConsole*/
	private ClientConsole clc;
	/**mm instance of GUI_ManagerMenu*/
	private GUI_ManagerMenu mm;
	/**r instance of GUI_Report*/
	private GUI_Report r;
	/**catalog instance of GUI_Catalog*/
	private GUI_Catalog catalog;
	/**rc instance of GUI_AddReaderCard*/
	private GUI_AddReaderCard rc;
	/**loanGui instance of GUI_loan*/
	private GUI_loan loanGui;
	/**rb instance of GUI_returnBook*/
	private GUI_returnBook rb;
	/**ec instance of Gui_ShowReaderCard*/
	private Gui_ShowReaderCard ec;
	/**sw instance of GUI_ShowWorkers*/
	private GUI_ShowWorkers sw;
	/**s instance of GUI_Search*/
	private GUI_Search s;
	
	/**@param cc current ClientConsole
	 * @param gl instance of current GUI_LogIn*/
	public GUI_ManagerMenu(ClientConsole cc, final GUI_LogIn gl)
	{
		setLayout(null);
		clc=cc;
		this.setSize(700,600);
		mm=this;
		JButton btnGetReport = new JButton("Get Report");
		btnGetReport.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				r=new GUI_Report(clc,gl,mm);
				gl.setContentPane(r);
			}
		});
		btnGetReport.setBounds(23, 284, 195, 23);
		add(btnGetReport);
		
		JButton btnManageCatalog = new JButton("Manage Book Catalog");
		btnManageCatalog.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				catalog=new GUI_Catalog(clc,gl,mm);
				gl.setContentPane(catalog);
			}
		});
		btnManageCatalog.setBounds(23, 49, 195, 23);
		add(btnManageCatalog);
		
		JButton btnReturnBook = new JButton("Return Book");
		btnReturnBook.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				rb=new GUI_returnBook(clc,gl,mm);
				gl.setContentPane(rb);
			}
		});
		btnReturnBook.setBounds(23, 96, 195, 23);
		add(btnReturnBook);
		
		JButton btnAddNewMember = new JButton("Add New Member");
		btnAddNewMember.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				rc=new GUI_AddReaderCard(clc,gl,mm);
				gl.setContentPane(rc);
			}
		});
		btnAddNewMember.setBounds(23, 142, 195, 23);
		add(btnAddNewMember);
		
		JButton btnNewButton = new JButton("Loan Book");
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				loanGui=new GUI_loan(clc,gl,mm);
				gl.setContentPane(loanGui);
			}
		});
		btnNewButton.setBounds(23, 192, 195, 23);
		add(btnNewButton);
		
		JLabel lblChooseOneOf = new JLabel("Choose One Of The Options:");
		lblChooseOneOf.setFont(new Font("Tahoma", Font.BOLD, 13));
		lblChooseOneOf.setBounds(23, 11, 220, 27);
		add(lblChooseOneOf);
		
		JButton btnLogOut = new JButton("Log Out");
		btnLogOut.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				gl.LogOut();
			}
		});
		btnLogOut.setBounds(471, 406, 89, 23);
		add(btnLogOut);
		
		JButton btnEditReadersCards = new JButton("Show Readers Cards");
		btnEditReadersCards.addActionListener(new ActionListener() {
			

			public void actionPerformed(ActionEvent arg0) {
				ec=new Gui_ShowReaderCard(clc,gl,mm);
				gl.setContentPane(ec);
			
			}
		});
		btnEditReadersCards.setBounds(23, 238, 195, 23);
		add(btnEditReadersCards);
		
		JButton btnShowWorkersDetails = new JButton("Show Workers Details");
		btnShowWorkersDetails.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				sw=new GUI_ShowWorkers(clc,gl,mm);
				gl.setContentPane(sw);
			}
		});
		btnShowWorkersDetails.setBounds(23, 329, 195, 23);
		add(btnShowWorkersDetails);
		
		JButton btnSearchBook = new JButton("Search Book");
		btnSearchBook.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				s=new GUI_Search(clc,mm);
				gl.setContentPane(s);
			}
		});
		btnSearchBook.setBounds(23, 373, 195, 23);
		add(btnSearchBook);
		
	}
}
